import type { UserLoginRequestParams, UserRegisterRequestParams } from '@/types/api/user'
import type { UserInfoType } from '@/types/user'
import request from '@/utils/request'

// 获取用户列表信息
export const getUserInfoAPI = () => request.get('/user/list')

// 登录
export const loginAPI = (data: UserLoginRequestParams) => request.post('/user/login', data)
export const loginAPI2 = (data: UserLoginRequestParams) => request.post('/api/login', data)

// 注册
export const registerAPI = (data: UserRegisterRequestParams) => request.post('/user/register', data)
export const registerAPI2 = (data: any) => request.post('/api/register', data)

// 退出登录
export const logoutAPI = (userId: string) => request.post('/user/delete', { userId })

// hello
export const helloAPI = () => request.get('/api/hello')

// 修改用户信息
export const putUserInfoAPI = (data: any) => request.put('/api/user', data)

// 获取用户信息
export const getUserInfoAPI2 = (): Promise<UserInfoType> => request.get('/api/user')
